package com.ruoyi.shop.api.factory;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.shop.api.RemoteCouponService;
import com.ruoyi.shop.api.RemoteShopService;
import com.ruoyi.shop.api.domain.CheShop;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 文件服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteCouponFallbackFactory implements FallbackFactory<RemoteCouponService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteCouponFallbackFactory.class);

    @Override
    public RemoteCouponService create(Throwable throwable) {
        log.error("优惠卷服务调用失败:{}", throwable.getMessage());
        return new RemoteCouponService() {
            @Override
            public AjaxResult getInfo(Long shopId, String source) {
                return AjaxResult.error("通过id获取优惠卷信息失败:" + throwable.getMessage());
            }

        };
    }
}

